import diff from "./diff"

export default function updateComponent (virtualDom, oldComponent, oldDom, container) {
  oldComponent.componentWillReceiveProps(virtualDom.props)
  if (oldComponent.shouldComponentUpdate(virtualDom.props)) {
    let prevProps = oldComponent.props
    oldComponent.componentWillUpdate(virtualDom.props)
    // 组件更新
    oldComponent.updateProps(virtualDom.props)
    let nextVirtualDom = oldComponent.render()
    nextVirtualDom.component = oldComponent
    diff(nextVirtualDom, container, oldDom)
    oldComponent.componentDidUpdate(prevProps)
  }

  
}